package com.yehangtech.designpattern.创建型_建造者.menu;


import com.yehangtech.designpattern.创建型_建造者.entity.IMatter;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

public class DecorationPackagingMenu implements IMenu {

    private List<IMatter> matterList = new ArrayList<>(16);

    private BigDecimal price = BigDecimal.ZERO;

    public List<IMatter> getMatterList() {
        return matterList;
    }

    public BigDecimal getPrice() {
        return price;
    }

    @Override
    public IMenu addCoat(IMatter matter) {
        matterList.add(matter);
        price = matter.price().add(price);
        return this;
    }

    @Override
    public IMenu addCeiling(IMatter matter) {
        matterList.add(matter);
        price = matter.price().add(price);
        return this;
    }

    @Override
    public List<IMatter> getDetail() {
        return matterList;
    }

    @Override
    public BigDecimal getPriceTotal() {
        return price;
    }
}
